Eclipse Platform
Pre-release 3.0

org.eclipse.team.core.subscribers
Class TeamSubscriber

java.lang.Object
  extended byorg.eclipse.team.core.subscribers.TeamSubscriber

public abstract class TeamSubscriber
extends Object

A TeamSubscriber provides synchronization between local resources and a remote location that is used to share those resources. [Note: How can we allow the refresh() operation to optimize the sync calculation based on the currently configured compare criteria?]


Constructor Summary
TeamSubscriber()
           
 
Method Summary
 void addListener(ITeamResourceChangeListener listener)
          Adds a listener to this team subscriber.
protected  void fireTeamResourceChange(TeamDelta[] deltas)
          Fires a team resource change event to all registered listeners Only listeners registered at the time this method is called are notified.
 SyncInfo[] getAllOutOfSync(IResource[] resources, int depth, IProgressMonitor monitor)
          Return an array of all out-of-sync resources (getKind() != 0) that occur under the given resources to the specified depth.
abstract  ComparisonCriteria[] getComparisonCriterias()
          Returns the list of available comparison criteria supported by this subscriber.
abstract  ComparisonCriteria getCurrentComparisonCriteria()
          Returns the comparison criteria that will be used by the sync info created by this subscriber.
abstract  String getDescription()
          Return the description of this subscription, in a format that is suitable for display to an end user.
abstract  IRemoteResource getRemoteResource(IResource resource)
          Returns a handle to the remote resource corresponding to the given resource, or null if there is no corresponding resource edition.
abstract  SyncInfo getSyncInfo(IResource resource, IProgressMonitor monitor)
          Returns synchronization info for the given resource, or null if there is no synchronization info because the subscriber does not apply to this resource.
abstract  boolean isSupervised(IResource resource)
          Returns true if this resource is supervised by this subscriber.
abstract  boolean isThreeWay()
          Answers true if the base tree is maintained by this subscriber.
abstract  IResource[] members(IResource resource)
          Returns all non-transient member resources of the given resource.
abstract  void refresh(IResource[] resources, int depth, IProgressMonitor monitor)
          Refreshes the resource hierarchy from the given resources and their children (to the specified depth) from the corresponding resources in the remote location.
 void removeListener(ITeamResourceChangeListener listener)
          Removes a listener previously registered with this team subscriber.
abstract  IResource[] roots()
          Returns the list of root resources this subscriber considers for synchronization.
abstract  void setCurrentComparisonCriteria(String id)
          Set the current comparison criteria to the one defined by the given id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TeamSubscriber

public TeamSubscriber()
Method Detail

getDescription

public abstract String getDescription()
Return the description of this subscription, in a format that is suitable for display to an end user. The description should contain enough details to understand the connection type of this subscriber.

Returns:
String representing the description of this subscription.

isSupervised

public abstract boolean isSupervised(IResource resource)
                              throws TeamException
Returns true if this resource is supervised by this subscriber. A supervised resource is one for which this subscriber maintains the synchronization state. Returns false in all other cases.

Returns:
true if this resource is supervised, and false otherwise
Throws:
TeamException

members

public abstract IResource[] members(IResource resource)
                             throws TeamException
Returns all non-transient member resources of the given resource. The result will include entries for resources that exist either in the workspace or are implicated in an incoming change. Returns an empty list if the given resource exists neither in the workspace nor in the corresponding team stream, or if the given resource is transient.

This is a fast operation; the repository is not contacted.

[Issue1 : Is there any filtering on the members? Just the ones that changed in some way, or *every member*? ]

Parameters:
resource - the resource
Returns:
a list of member resources
Throws:
CoreException - if this request fails. Reasons include:
TeamException

roots

public abstract IResource[] roots()
Returns the list of root resources this subscriber considers for synchronization. A client should call this method first then can safely call members to navigate the resources managed by this subscriber.

Returns:
a list of resources
Throws:
TeamException

getRemoteResource

public abstract IRemoteResource getRemoteResource(IResource resource)
                                           throws TeamException
Returns a handle to the remote resource corresponding to the given resource, or null if there is no corresponding resource edition.

This is a fast operation; the repository is not contacted.

Parameters:
resource - the resource
Returns:
a server resource
Throws:
CoreException - if this request fails. Reasons include:
  • ???
TeamException

getSyncInfo

public abstract SyncInfo getSyncInfo(IResource resource,
                                     IProgressMonitor monitor)
                              throws TeamException
Returns synchronization info for the given resource, or null if there is no synchronization info because the subscriber does not apply to this resource.

Note that sync info may be returned for non-existing or for resources which have no corresponding remote resource.

This method may take some time; it depends on the comparison criteria that is used to calculate the synchronization state (e.g. using content or only timestamps).

Parameters:
resource - the resource of interest
Returns:
sync info
Throws:
TeamException

refresh

public abstract void refresh(IResource[] resources,
                             int depth,
                             IProgressMonitor monitor)
                      throws TeamException
Refreshes the resource hierarchy from the given resources and their children (to the specified depth) from the corresponding resources in the remote location. Resources are ignored in the following cases:

getComparisonCriterias

public abstract ComparisonCriteria[] getComparisonCriterias()
Returns the list of available comparison criteria supported by this subscriber.


getCurrentComparisonCriteria

public abstract ComparisonCriteria getCurrentComparisonCriteria()
Returns the comparison criteria that will be used by the sync info created by this subscriber.


setCurrentComparisonCriteria

public abstract void setCurrentComparisonCriteria(String id)
                                           throws TeamException
Set the current comparison criteria to the one defined by the given id. An exception is thrown if the id is not suported by this subscriber.

Throws:
TeamException

isThreeWay

public abstract boolean isThreeWay()
Answers true if the base tree is maintained by this subscriber. If the base tree is not considered than the subscriber can be considered as not supported three-way comparisons. Instead comparisons are made between the local and remote only without consideration for the base.


addListener

public void addListener(ITeamResourceChangeListener listener)
Adds a listener to this team subscriber. Has no effect if an identical listener is already registered.

Team resource change listeners are informed about state changes that affect the resources supervised by this subscriber.

Parameters:
listener - a team resource change listener

removeListener

public void removeListener(ITeamResourceChangeListener listener)
Removes a listener previously registered with this team subscriber. Has no affect if an identical listener is not registered.

Parameters:
listener - a team resource change listener

fireTeamResourceChange

protected void fireTeamResourceChange(TeamDelta[] deltas)
Fires a team resource change event to all registered listeners Only listeners registered at the time this method is called are notified. Listener notification makes use of an ISafeRunnable to ensure that client exceptions do not effect the notification to other clients.


getAllOutOfSync

public SyncInfo[] getAllOutOfSync(IResource[] resources,
                                  int depth,
                                  IProgressMonitor monitor)
                           throws TeamException
Return an array of all out-of-sync resources (getKind() != 0) that occur under the given resources to the specified depth. The purpose of this method is to provide subscribers a means of optimizing the determination of all out-of-sync out-of-sync descendants of a set of resources.

A return value of an empty array indicates that there are no out-of-sync resources supervised by the subscriber. A return of null indicates that the subscriber does not support this operation in an optimized fashion. In this case, the caller can determine the out-of-sync resources by traversing the resource structure form the roots of the subscriber (@see getRoots()).

Parameters:
resources -
depth -
monitor -
Returns:
Throws:
TeamException

Eclipse Platform
Pre-release 3.0

Copyright (c) IBM Corp. and others 2000, 2003. All Rights Reserved.